package offer;

public class offerII_0032 {
    public boolean isAnagram(String s, String t) {
        int[] num=new int[26];
        int len1=s.length();
        int len2=t.length();
        if(len1!=len2) return false;
        for(int i=0;i<len1;++i){
            num[s.charAt(i)-'a']+=1;
            num[t.charAt(i)-'a']-=1;
        }
        for(int i=0;i<26;++i){
            if(num[i]!=0) return false;
        }
        for(int i=0;i<len1;++i){
            if(s.charAt(i)!=t.charAt(i)) return true;
        }
        return false;
    }
}
